
s=input("Введите строку")
s1=''
s2=''
fl=0
for i in range(len(s)):
    si=s[i]
    if si in "{[(<":
        s2=s2+si
    elif si in "}])>":
        if len(s2)==0:
            fl=1
            break
        else:
            if(si=='}' and s2[-1]=='{') or (si==']' and s2[-1]=='[') or (si==')' and s2[-1]=='(') or (si=='>' and s2[-1]=='<'):
                s2=s2[:-1]
            else:
                fl=1
                break
if len(s2)==0 and fl==0:
    print("True")
else:
    print("False")